package com.tianji.learning.enums;

/**
 * 风险等级枚举
 */
public enum RiskLevel {
    NONE("none", "无风险"),
    LOW("low", "低风险"),
    MEDIUM("medium", "中风险"),
    HIGH("high", "高风险");
    
    private final String code;
    private final String description;
    
    RiskLevel(String code, String description) {
        this.code = code;
        this.description = description;
    }
    
    public String getCode() {
        return code;
    }
    
    public String getDescription() {
        return description;
    }
    
    public static RiskLevel fromCode(String code) {
        for (RiskLevel level : values()) {
            if (level.code.equals(code)) {
                return level;
            }
        }
        return NONE;
    }
}